package atm;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 转账界面
 */
public class TransferPanel extends JPanel implements ActionListener {
    private ATM05 atm05;
    private JLabel accountLabel = new JLabel("请输入对方账号:");
    private JTextField accountTextField = new JTextField();
    private JLabel transferLabel = new JLabel("请输入转账金额:");
    private JTextField transferTextField = new JTextField();
    private JButton sureBtn = new JButton(new ImageIcon("images/buttonSure.jpg"));
    private JButton clearBtn = new JButton(new ImageIcon("images/buttonClear.jpg"));
    private Font font = new Font("宋体",Font.BOLD,25);

    public TransferPanel(ATM05 atm05){
        this.atm05 = atm05;
        this.setLayout(null);
        this.setOpaque(false);

        accountLabel.setBounds(150,200,300,50);
        accountLabel.setFont(font);
        accountTextField.setBounds(450,200,250,50);
        accountTextField.setFont(font);
        transferLabel.setBounds(150,250,300,50);
        transferLabel.setFont(font);
        transferTextField.setBounds(450,250,250,50);
        transferTextField.setFont(font);
        sureBtn.setBounds(320,320,100,50);
        clearBtn.setBounds(450,320,100,50);
        sureBtn.addActionListener(this);

        this.add(accountLabel);
        this.add(accountTextField);
        this.add(transferLabel);
        this.add(transferTextField);
        this.add(sureBtn);
        this.add(clearBtn);
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        atm05.showPanel("menu");
    }
}
